1. Field of the Invention
The present invention relates generally to a method and apparatus for searching an electronically stored table of information including a plurality of table entries, and more specifically to a method and apparatus for facilitating high speed linear searching of a table by a plurality of agents that are each required to search many entries of the table using different search keys.
2. Description of the Related Art
In the fields of electronic data communications and data processing, electronically stored tables of information are used in vast variety of applications to provide a mapping between two or more information spaces. The tables of information, which include a plurality of entries, may be searched in accordance with many different methods.
Generally, a searching agent searches a table using a search key, and may read one or more tables entries to determine an exact match or a best match depending on the particular application requirements. It is a common design requirement that each of a plurality of searching agents having different search keys is required to search a single table of information. For applications in which it is generally not feasible to employ a multiplicity of memory devices storing the same table of information, an arbitration scheme is typically employed to resolve requests from each of the searching agents for access to the single table.
Many algorithms and devices have been developed to efficiently search tables of information. A basic brute force method is linear searching wherein a device searches a table linearly one entry at a time. Linear searching is the simplest search method, and it is ideal for searching small tables in applications having slow search requirements. However, linear searching becomes impractical as the table sizes increase because the maximum search time is proportional to the table size.
In order to shorten the table search time, binary searching methods may be used wherein all entries of the table are sorted in a particular order, and the search times are equal to log2 (table size). Binary searching methods are particularly desirable for searching large tables using software, but sorting the table entries in a particular order is not a simple task. Due to this high maintenance requirement, binary searching is often not feasible to implement in hardware.
One of the quickest methods of table searching uses content addressable memory (CAM) searching wherein all table entries are compared against a search key at the same time, and the search result is delivered to an output instantly. However, CAM searching provides high search performance at the expense of implementing greater logic using a greater amount of silicon real estate. Moreover, there is typically a limit to the size of comparison fields (i.e. data width) and the size of payload fields which may be used in CAM searching.
Some of the most common methods of table search employ hashing algorithms in which table entries are grouped into different buckets in accordance with the particular type of hashing algorithm (i.e. crc32). Searching systems employing hashing algorithms are capable of narrowing the searching area to a specific location (a bucket), and this limits the maximum searching time. The maximum table searching time is based on the size of the bucket, and the table search time remains constant as the number of buckets increases. As the number of the table entries increase, the possibility that two or more entries are hashed to a same bucket also increases. If the maximum table entry (the size of table) is considerably larger than the typical number of entries used at the same time and the hash algorithm spreads the entries evenly, there is a good chance that only one or two entries are in a bucket. In this case, the average search time will be rather short (one or two clock cycles per search). A good hash algorithm scatters table entries evenly over the search table, but there is a possibility that many table entries may hashed into the same bucket. Thus, using 100 percent of a table is not practical, and the size of the table often needs to be much larger than the typical number of table entries.
In the field of data communications, there are many applications wherein each of a plurality of searching agents is required to search a single table of information. In routing and switching devices, a table of information is often used to provide a mapping mechanism for forwarding data, typically in the form of a packet (e.g., an Ethernet Packet), from one location to another location.
As packets arrive at each of a plurality of associated ports of a switch or router device, a plurality of port searching agents, each associated with one of the ports, must search information stored in the table to determine an appropriate action. For example, if the table includes an entry providing a direction for the arrived packet, the device forwards the packet in the direction indicated. If the table does not include an entry providing a direction for the arrived packet, the device may handle the packet based on a default setting. Examples of default settings include sending the packet to all available ports (broadcasting), sending the packet to a central processing unit (CPU) for analysis in accordance with a predefined set of rules, or dropping the packet. For Ethernet routing applications, a table of information is typically organized based on particular fields (e.g., a medium access control (MAC) Address, an IP Address, a Virtual LAN ID, etc.) of a packet. When particular fields of the packet match particular fields of the table, the device utilizes the corresponding information in the table to forward the packet.
In conventional table searching systems wherein each of a plurality searching agents is required to search a single table of information, a “pull” searching method is typically employed wherein each of the searching agents is required to initiate table searching. An arbitration scheme is usually employed to resolve requests initiated by each of a plurality of searching agents for access to the single table.
FIG. 1 shows a generalized block diagram of a conventional table information searching system at 10, the system operating in accordance with conventional pull search techniques. The system 10 includes a plurality of N+1 searching agents 12 designated AGENT_0, AGENT_1, . . . AGENT_N. As an example, each of the searching agents 12 may be a port agent communicatively coupled with a receiving port of a switching device. Each of the searching agents 12 includes: a receiver port 14 for receiving a search key (e.g., a destination address of a data jacket); an arbitration request signal output port 16 for providing one of a plurality of N+1 request signals designated REQ_0, REQ_1, . . . REQ_N; an arbitration grant signal input port 18 for receiving an associated one of a plurality of N+1 grant signals designated GNT_0, GNT_1, . . . GNT_N; a table data input port 20 for receiving table information via a table data bus 21 as further explained below; and a memory address output port 22 for providing address values to a search address bus 23 as further explained below.
The system 10 further includes; an arbitration logic unit 26 having a plurality of request signal input ports 28 for receiving associated ones of the arbitration request signals, and a plurality of N+1 arbitration grant signal output ports 30 each providing an associated one of the arbitration grant signals to port 18 of an associated one of the agents 12; and a table information memory unit 36 for storing a table of information, and having a table data output port 38 for providing table data to the table data input port 20 of selected ones of the searching agents 12 via the bus 21, and a search address input port 40 for receiving the memory address values from the ports 22 of selected ones of the agents 12.
The table information memory unit 36 is typically implemented using static random access memory (SRAM) technology, and therefore only one of the entries of the table of information stored therein may be accessed at a time. Because of this fundamental feature of SRAM technology, only one of the agents 12 may access the table information unit 36 at a time. However, each of the agents 12 may have a different search key value for searching the table stored in the memory unit 36, and therefore there is a conflict.
Because only one of the table entries stored in the memory unit 36 may be accessed at a time, the arbitration logic unit 26 is needed to arbitrate among requests received from the searching agents 12 for access to the memory unit. The arbitration logic unit 26 receives and resolves the requests, and provides the grant to select corresponding ones of the searching agents 12. In response to the associated one of the grant signals being asserted, a selected searching agents 12 begins to provide one or more address values sequentially to port 40 of the memory unit 36 via the bus 23. In response to each of the address values, the memory unit provides the contents of a table entry stored at the specified address, to all the agents via the data bus, although only selected agents process the data from the memory. Each of the agents is operative to execute a searching process to determine a match between the search key value and one of the table entries. If the searching system needs to search every table entry to determine a best available match, instead of an exact match, the required search time becomes very lengthy.
A problem associated with the prior art table searching system 10 is that the system is not scalable to a large number of searching agents 12 because only one of the agents 12 may access the table information unit 36 at a given time, and so the total required search time for processing all the search key increases linearly as the number of searching agents increases because only one search key can be processed at a time in accordance with “pull” search techniques. Stated alternatively, the total number of cycles required for searching is proportional to the number of searching agents.
For example, in a switching device, as the number of port searching agents (each having a different destination address of an associated incoming packet) increases linearly, the required search time increases linearly because only one packet can be processed at a time in accordance with “pull” search techniques. This becomes a major performance bottleneck when the switching device requires the processing of a large number of packets simultaneously. For example, if the minimum packet forwarding time is 80 clock cycles and the maxim search time is eight clock cycles, the switching device can forward a maximum of ten packets at the same time. If the switching device needs to forward more than ten packets at the same time, then search table using a “pull” search technique becomes a performance bottleneck. This is especially crucial if the maximum search time is very large. If the searching system needs to search every table entry to determine a best available match, instead of an exact match, the search time for processing multiple packets is quite lengthy.